package net.huashitong.user.service;

import net.huashitong.user.dao.SysValidDao;
import net.huashitong.user.entity.SysValid;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;

@Service
public class SysValidService extends StringPKService<SysValid> {

	@Autowired
	private SysTableService tableService;
	
	@Autowired
	private SysValidDao dao;
	
	@Override
	protected BaseDao<SysValid, String> getDao() {
		return dao;
	}

	public SysValid getByMobile(String mobile) {
		return dao.getByMobile(mobile);
	}
	@Override
	protected void beforeSave(SysValid sysValid) {
		sysValid.setSysId(tableService.updateMaxSysId("t_sys_valid", null));
	}
}
